package com.fenghongzhang.banner;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.youth.banner.Banner;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Banner banner = (Banner) findViewById(R.id.banner);
        //设置图片加载器
        banner.setImageLoader(new GlideImageLoader());
        //设置图片集合

        List<String> list = new ArrayList<>();
        list.add("http://image.biaobaiju.com/uploads/20190521/15/1558422381-LwMnpZCNHX.jpg");

        list.add("http://image1.xyzs.com/upload/6a/11/1449797213923014/20151212/144987374847029_0.jpg");
        banner.setImages(list); //可以是本地,是可以网络
        //banner设置方法全部调用完毕时最后调用
        banner.setDelayTime(500);
        banner.start();
    }
}
